FROM openjdk:8-jre-alpine

LABEL maintainer="yizhang"

# 修改时区
RUN apk add -U tzdata && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone

COPY target/*.jar /app.jar

# 用来接收启动时动态传入的参数 如 docker run -e JAVA_OPTS="-Xmx512m" -e PARAMS="--spring.profiles=dev --server.port=8080"
ENV JAVA_OPTS=""
ENV PARAMS=""
# 运行jar包
ENTRYPOINT [ "sh", "-c", "java -Djava.security.egd=file:/dev/./urandom $JAVA_OPTS -jar /app.jar $PARAMS" ]